#include "oglhelper.h"

#include "glextensions.h"

namespace Opl{ namespace Gui { namespace Helpers { namespace OpenGL {

GLfloat* copyData(GLfloat* o, const QMatrix4x4& m)
{
	const qreal *data = m.constData();
	for (int index = 0; index < 16; ++index)
		o[index] = data[index];

	return o;
}

void loadMatrix(const QMatrix4x4& m)
{
	// static to prevent glLoadMatrixf to fail on certain drivers
	static GLfloat mat[16];
	glLoadMatrixf(copyData(mat, m));
}

void multMatrix(const QMatrix4x4& m)
{
	// static to prevent glMultMatrixf to fail on certain drivers
	static GLfloat mat[16];
	glMultMatrixf(copyData(mat, m));
}

};};};}
